package com.wkr.send;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class task {

    @Autowired
    private Sender sender;

    @Scheduled(cron = "0/10 * * * * ?")//每隔1秒隔行一次
    private void taskTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        sender.sendMessage(simpleDateFormat.format(new Date()));
    }

}
